<?php if($error == false) {?>
<div class="section" id="sitemaplist">
	<form action="" name="formlist" id="formlist" method="post">
	<div class="section-title">
		PARTNER DEBT REPORT
		  <div class="button right">
			<input class="button" type="button" name="print" value="Print" onclick="printlist()"/>  
			<input class="button" type="button" name="close" value="<?php echo $this->document->text['button_close']?>" onclick="window.close()"/>  
			<input type="hidden" name="display" id="display" value="" />
		</div>
		<div class="clearer">^&nbsp;</div>
	</div>
    
    <div class="section-content">
    	<table width="1028px" style="width:1028px">
			<tbody>
				<tr>
					<td width="100%">
						<table align="center" width="100%">
							<tbody>
								<tr>
									<td valign="top" style="text-align:left; vertical-align:top" width="30%">
										<b>TESRENG FEDERAL PAINT COMPANY</b><br>
										Tel: 012 855 424 - 097 97 37 222<br>
										Email: tesreng@gmail.com
									</td>
									<td valign="top" style="text-align:center; vertical-align:top" width="70%">
										<h2 style="padding:5px; margin-bottom:10px">PARTNER DEBT REPORT</h2>
										<div style="clear:both"></div>
										<div style="text-align:left">
											<table>
												<tr>
													<td style="text-align:left">Partner: <?php echo $user['fullname']?></td>
												</tr>
												<tr>
													<td style="text-align:left"><?php echo $this->document->text['text_address']?>: <?php echo $user['address']?></td>
												</tr>
												<tr>
													<td style="text-align:left"><?php echo $this->document->text['text_phone']?>: <?php echo $user['phone']?></td>
												</tr>
												<tr>
													<td style="text-align:left"><?php echo $this->document->text['text_fax']?>: <?php echo $user['fax']?></td>
												</tr>
												<tr>
													<td style="text-align:left"><?php echo $this->document->text['text_email']?>: <?php echo $user['email']?></td>
												</tr>
												
											</table>
										</div>
										<div style="clear:both"></div>
									</td>
								</tr>
							</tbody>
						</table>
						<table class="grid" style="width:1028px" align="center" cellpadding="5" cellspacing="0">
							<thead style="font-weight:bold">
								<th width="28px">No.</th>
								<th width="50px"><?php echo $this->document->text['text_date']?></th>
								<th width="90px">Account</th>
								<th width="90px"><?php echo $this->document->text['text_description']?>:</th>
								<th width="80px"><?php echo $this->document->text['text_orderno']?></th>
								<th width="50px">OrderTotal</th>
								<th width="70px"><?php echo $this->document->text['text_vouchernol']?>:</th>
								<th width="120px">Payment Amount</th>
							</thead>
							<tbody>
								<?php
									$index = 0;
									foreach($reports as $report)
									{
										$index += 1;
								?>
											<tr>
												<td><?php echo $index?></td>
												<td><?php echo $this->date->formatMySQLDate($report['voucherdate'])?></td>
												<td><?php echo $accounttype[$report['vouchergroup']]?></td>
												<td><?php echo $report['description']?></td>
												<td><?php echo $report['ordernumber']?></td>
												<td class="calc" style="text-align:right"><?php echo $report['grandtotal']?></td>
												<td><?php echo $report['voucherno']?></td>
												<td class="calc" style="text-align:right"><?php echo $report['paymentamount']?></td>                 
											</tr>
								<?php
									}
								?>
								
								<tr bgcolor="#CCCCCC">
									<td colspan="5" style="text-align:right; font-weight:bold">Total Order : </td>
									<td class="calc" style="text-align:right; font-weight:bold"><?php echo $user['debttotal']?></td>
									<td style="text-align:right; font-weight:bold"><?php echo $this->document->text['text_totalpaid']?></td>
									<td class="calc" style="text-align:right; font-weight:bold"><?php echo $user['paidtotal']?></td>                 
								</tr>
							
							</tbody>
						</table>
						
						<h3 style="text-align:right"><?php echo $this->document->text['text_debtbalance']?> : <span class="calc"><?php echo $user['debtbalance']?></span></h3>
						
						
					</td>
				</tr>
			</tbody>
			
		</table>
    
    </div>
    </form>
</div>
<script language="javascript">
$(function() {
		$("#search_fromdate").datepicker({
				changeMonth: true,
				changeYear: true,
				dateFormat: 'dd/mm/yy'
				});
		
		
		$("#search_todate").datepicker({
				changeMonth: true,
				changeYear: true,
				dateFormat: 'dd/mm/yy'
				});		
		
		$(".calc").each(function(){
			num = formateNumber($(this).html().replace(/,/g,""));
			$(this).html(num);
		});
		
		$('.orderlink').popupWindow({ 
			height:600, 
			width:1020, 
			centerScreen:1,
			scrollbars: 1,
			resizable : 1,
			status: 0,
			location: 0
		});
		
});
		
		

function deleteList1()   
{
	$.post("?route=voucher/search/deleteorder", 
			$("#formlist").serialize(), 
			function(data)
			{
				if(data!="")
				{
					alert(data)
					linkto("?<?php echo $refres?>")
				}
			}
	);
}

function printlist()   
{
	$("#display").val("report");
	$("#formlist").attr("target","_self");
	$("#formlist").submit();
	$("#display").val("report");
	$("#formlist").attr("target","");
}

</script>







<style>
body{font-family:Arial, Helvetica, sans-serif; font-size:10pt}
table{font-size:11pt}
table th{font-weight:bold; text-align:left}
.grid th, .grid td {font-size:10pt}
.grid td{ border:1px dotted #CCCCCC}
.grid th{ text-align:center; border:1px dotted #999999}
.sign td{width:25%; text-align:center; font-weight:bold}
</style>

<script src="<?php echo DIR_JS?>jquery.js" type="text/javascript"></script>
<script>
	$(document).ready(function(){
		$(".calc").each(function(){
			num = formateNumber($(this).html().replace(/,/g,""));
			$(this).html(num);
		});
	});
	
	function printlist()   
	{
		$("#display").val("report");
		$("#formlist").attr("target","_self");
		$("#formlist").submit();
		$("#display").val("report");
		$("#formlist").attr("target","");
	}
</script>

<?php } else  {?>
<h1>Occur Error!</h1>
<?php } ?>

